home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / utility / stricmp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-13  |  1.5 KB  |  76 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: stricmp.c,v 1.4 1996/09/13 17:33:30 digulla Exp $
  4.     $Log: stricmp.c,v $
  5.     Revision 1.4  1996/09/13 17:33:30  digulla
  6.     Use the ToLower function instead of the macro
  7.  
  8.     Revision 1.3  1996/08/13 14:10:31  digulla
  9.     Replaced __AROS_LA by __AROS_LHA
  10.  
  11.     Revision 1.2  1996/08/01 17:41:41  digulla
  12.     Added standard header for all files
  13.  
  14.     Desc:
  15.     Lang: english
  16. */
  17. #include <exec/types.h>
  18. #include <aros/libcall.h>
  19. #include "utility_intern.h"
  20.  
  21. /*****************************************************************************
  22.  
  23.     NAME */
  24.     #include <clib/utility_protos.h>
  25.  
  26.     __AROS_LH2(LONG, Stricmp,
  27.  
  28. /*  SYNOPSIS */
  29.     __AROS_LHA(STRPTR, string1, A0),
  30.     __AROS_LHA(STRPTR, string2, A1),
  31.  
  32. /*  LOCATION */
  33.     struct UtilityBase *, UtilityBase, 27, Utility)
  34.  
  35. /*  FUNCTION
  36.     Compares two strings treating lower and upper case characters
  37.     as identical.
  38.  
  39.     INPUTS
  40.     string1, string2 - The strings to compare.
  41.  
  42.     RESULT
  43.     <0  if string1 <  string2
  44.     ==0 if string1 == string2
  45.     >0  if string1 >  string2
  46.  
  47.     NOTES
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.  
  55.     INTERNALS
  56.  
  57.     HISTORY
  58.  
  59. *****************************************************************************/
  60. {
  61.     __AROS_FUNC_INIT
  62.     UBYTE c1, c2;
  63.  
  64.     /* Loop as long as the strings are identical and valid. */
  65.     do
  66.     {
  67.     /* Get characters, convert them to lower case. */
  68.     c1=ToLower(*string1++);
  69.     c2=ToLower(*string2++);
  70.     }while(c1==c2&&c1);
  71.  
  72.     /* Get result. */
  73.     return (LONG)c1-(LONG)c2;
  74.     __AROS_FUNC_EXIT
  75. } /* Stricmp */
  76.